package com.spc.car.service.standard.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.spc.car.data.entity.std.StdGbOrgType;
import com.spc.car.data.service.std.StdGbOrgTypeService;
import com.spc.car.service.standard.OrgTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrgTypeServiceImpl implements OrgTypeService {

    @Autowired
    private StdGbOrgTypeService stdGbOrgTypeService;

    @Override
    public List<StdGbOrgType> listSubType(String parentCode) {
        return stdGbOrgTypeService.list(new QueryWrapper<StdGbOrgType>()
                .isNull(StringUtils.isBlank(parentCode), "parent_code")
                .eq(StringUtils.isNotBlank(parentCode), "parent_code", parentCode));
    }
}
